home *** CD-ROM | disk | FTP | other *** search
- Path: news.infi.net!usenet
- From: nngis@norfolk.infi.net (Greg DiGiorgio)
- Newsgroups: comp.lang.c
- Subject: Re: printf - adding commas to numbers
- Date: 11 Jan 1996 15:42:45 GMT
- Organization: Customer of InfiNet
- Message-ID: <4d3b5l$fsm@news.infi.net>
- References: <4d15eq$lc5@ixnews2.ix.netcom.com>
- Reply-To: nngis@norfolk.infi.net
- NNTP-Posting-Host: h-langoliers.norfolk.infi.net
- Mime-Version: 1.0
- X-Newsreader: WinVN 0.99.3
-
- In article <4d15eq$lc5@ixnews2.ix.netcom.com>, chuckh@ix.netcom.com
- says...
- >
- >Is there a simple way with a printf format specifier to add commas to
- >an integer?
-
- *** No.
- >
- >For example, if the value of integer i is 12345 I want the output to
- >be:
- >
- >12,345.
-
- *** I understand.
-
- >
- >I know this can be done in a function but I'd think that printf ought
- >to have such capability since it's such a common output format.
-
- *** That's correct, it can be done in a function. How often would you
- *** use it? For check writing, some financials, but not much else.
- *** Therefore, should "printf" which is big enough as it is, be changed
- *** to incorporate commas like BASIC's "Print Using" stmt? How about
- *** if I want to show currency in european format? Should "printf" do
- *** that as well? What if I want "12345" to print vertically, one number
- *** per line? Should print be able to do that?
- ***
- *** I think you can see my point. The line has to be drawn somewhere,
- *** else 'C' programs would be so big due to intrinisic functions,
- *** that they would not fit well into embedded systems or small
- *** handhelds (weak argument I know given multi-megabyte RAM nowadays).
- >
- >Please respond via E-mail since I don't check this group often.
- >--
- >Chuck Hamilton
- >chuckh@ix.netcom.com
- >
- >If at first you don't succeed, skydiving isn't for you.
- >
-
-